package com.heima.wemedia.controller.v1;

import com.heima.model.admin.adminDto.AdSensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.dto.SensitiveDto;
import com.heima.model.wemedia.dto.WmNewsPageReqDto;
import com.heima.wemedia.service.WmSensitiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author shitou
 * @className WmSensitiveServiceController
 * @description: TODO
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveServiceController {

    @Resource
    private WmSensitiveService wmSensitiveService;

    /**
     * 敏感词查询列表
     *
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {

        return wmSensitiveService.findSensitiveList(dto);
    }


    /**
     * 敏感词新增
     *
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody AdSensitiveDto dto) {

        return wmSensitiveService.saveSensitive(dto);
    }

    /**
     * 敏感词删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult list(@PathVariable Integer id) {

        return wmSensitiveService.delSensitiveById(id);
    }


    /**
     * 敏感词修改
     *
     * @param dto
     * @return
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitiveDto dto) {

        return wmSensitiveService.updateSensitive(dto);
    }


}
